package com.szpx.litianjian.mapper;

import com.szpx.litianjian.entity.StudentDetailInfo;
import com.szpx.litianjian.entity.StudentInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface StudentMapper {
    @Select("select id, stu_number, stu_name from student_info where id = #{id}")
    StudentInfo getStudentInfoById(Integer id);

    @Select("select t2.project_id,t3.id as stu_id,t3.stu_number,t2.group_number,\n" +
            "t2.class_grade,t2.class_name,t3.stu_id_number,\n" +
            "t3.stu_name,t2.leader_name,t1.project_name,\n" +
            "(SUM(t4.score)) / 2 as basic_score,\n" +
            "t3.project_url\n" +
            "from project_info t1\n" +
            "join project_group_basic_info t2\n" +
            "on t2.project_id = t1.id\n" +
            "join student_info t3\n" +
            "on t3.id = t2.student_id\n" +
            "join student_and_score t4\n" +
            "on t4.stu_id = t3.id\n" +
            "join score t5 on t5.id = t4.score_id\n" +
            "where t3.id = #{stuId}")
    StudentDetailInfo getStudentDetailInfoByStudentId(Integer stuId);
}
